Query: Bind with members when type has cast to interface #17438
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #17276
Resolves #17099
Resolves #16759
Description
EF Core doesn't support mapping to interfaces directly. However, people frequently work with interfaces and we have provided guidance many times in the past on patterns that involve casting or using generic type constraints to work with interfaces. These patterns are not working in the new query pipeline like they were in the old, so we want to take a change for 3.0 that will allow these patterns to work again.
Example:
Customer Impact
We expect that continuing to work with interfaces will be a common customer requirement for EF Core 3.0. We have not been able to come up with other workarounds that allow this.
Regression?
Yes, from 2.2.
Risk
The risk here is low because the code now handles interfaces types where it previously it would result in an exception. These changes are localized to specific places in the code and should have no impact on the handling of non-interface types.